﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%option explicit%>
<%
Dim RZ_IN
RZ_IN=1
%>
<!--#include file="../conn.inc.asp" -->
<!--#include file="admin_inc/admin.function.asp" -->
<!--#include file="admin_inc/admin.sqlfunction.asp" -->
<%
'作者：山林客（ah_bill）
'博客：http://ruizhinet.blog.163.com
'网站：http://www.ruizhinet.cn
'本信息不会影响您网站的正常访问，请保留
checkadmin(1)
dim ids,listtype,from,tablename,fenlei
ids=request.form("id")
listtype=request.Form("listtype")
S_LANG=GetIntQueryString("lang")
select case listtype
	case "product":
		tablename="c_product"
		from="product_list.asp"
		fenlei=2
	case "article":
		tablename="c_article"
		from="article_list.asp"
		fenlei=1
	case "photo":
		tablename="c_photo"
		from="photo_list.asp"
		fenlei=3
	case "job":
		tablename="c_job"
		from="job_list.asp"
		fenlei=7
	case "ad":
		tablename="c_advertise"
		from="advertise_list.asp"
	case "comment":
		tablename="c_comment"
		from="comment_list.asp"
	case "recordcomment":
		tablename="c_record_comment"
		from="recordcomment_list.asp"
	case "words":
		tablename="c_words"
		from="words_list.asp"
	case "model":
		tablename="c_model"
		from="model_list.asp"
	Case "friendlink"
		tablename="c_friendlink"
		from="friendlink_list.asp"
	Case "special"
		tablename="c_special"
		from="special_list.asp"
end select

If listtype="product" Or listtype="article" Or listtype="photo" Or listtype="job" Then
		If app("rz_static")=1 Then
			Dim htmlleft
			Select Case fenlei
				Case 1:
					htmlleft=RZ_HTML_PATH&"/"&RZ_PRE_ARTICLE_SHOW
				Case 2:
					htmlleft=RZ_HTML_PATH&"/"&RZ_PRE_PRODUCT_SHOW
				Case 3:
					htmlleft=RZ_HTML_PATH&"/"&RZ_PRE_PHOTO_SHOW
				Case 7:
					htmlleft=RZ_HTML_PATH&"/"&RZ_PRE_JOB_SHOW
			End Select 
			Dim rsa,sqla,path,specialid,lang,static_path,filepath,reid
			Set rsa = Server.CreateObject("ADODB.Recordset")
			sqla = "select path,specialid,lang,id from ["&tablename&"] where id in ( " & ids & ")"
			rsa.open sqla,conn,1,1
			Do While Not rsa.eof 
			path=CutPath(rsa("path"))
			specialid=rsa("specialid")
			lang=rsa("lang")
			reid=rsa("id")
			Call updateTypeModifytime(path,Now())

			static_path=Replace(path,",","-")
			filepath=htmlleft&lang&"/t"&static_path&"/c"&reid&".html"
			Call DeleteHtml(filepath)
			If specialid>0 Then 
			filepath=htmlleft&lang&"/t"&static_path&"/s"&specialid&"c"&reid&".html"
			Call DeleteHtml(filepath)

			End If 
			rsa.movenext
			loop
			rsa.close
			Set rsa=Nothing 
			conn.Execute("delete from ["&tablename&"] where id in ( " & ids & ")")
			conn.Execute("update [c_record_comment] set visible=0 where fenlei="&fenlei&" and recordid in (" & ids & ")")
			response.write("<script type='text/javascript'>var flag;flag=confirm('您批量删除了文章，您是否要更新相关HTML文件');")
			response.write("if(flag==true){location.href='makehtml.asp?onestep=1';}")
			response.write("else{location.href='showmsg.asp?from="&from&"&msg=RemoveSuccess&lang="&S_LANG&"';}")
			response.write("</script>")
		Else 
			conn.Execute("delete from ["&tablename&"] where id in ( " & ids & ")")
			conn.Execute("update [c_record_comment] set visible=0 where fenlei="&fenlei&" and recordid in (" & ids & ")")
			response.redirect("showmsg.asp?from="&from&"&msg=RemoveSuccess&lang="&S_LANG)
		End If 
ElseIf listtype="special" Then
		Dim rs,sql
		Set rs = server.CreateObject("adodb.recordset")
		sql="select * from [c_article] where specialid in ( " & ids & ")"
		rs.open sql,conn,1,3
		Do While Not rs.eof
		rs("specialid")=0
		rs("modifytime")=Now()
		rs.update
		rs.movenext
		Loop 
		rs.close
		Set rs=Nothing 
		Set rs = server.CreateObject("adodb.recordset")
		sql="select * from [c_product] where specialid in ( " & ids & ")"
		rs.open sql,conn,1,3
		Do While Not rs.eof
		rs("specialid")=0
		rs("modifytime")=Now()
		rs.update
		rs.movenext
		Loop 
		rs.close
		Set rs=Nothing 
		Set rs = server.CreateObject("adodb.recordset")
		sql="select * from [c_photo] where specialid in ( " & ids & ")"
		rs.open sql,conn,1,3
		Do While Not rs.eof
		rs("specialid")=0
		rs("modifytime")=Now()
		rs.update
		rs.movenext
		Loop 
		rs.close
		Set rs=Nothing 
		conn.Execute("delete from [c_special] where id in ( " & ids & ")")
		response.redirect("showmsg.asp?from="&from&"&msg=RemoveSuccess&lang="&S_LANG)
Else
	conn.Execute("delete from ["&tablename&"] where id in ( " & ids & ")")
	if listtype="comment" Then
		conn.Execute("delete from [c_reply] where commentid  in ( " & ids & ")")
	end If
	if listtype="recordcomment" Then
		conn.Execute("delete from [c_record_reply] where commentid  in ( " & ids & ")")
	end If
	response.redirect("showmsg.asp?from="&from&"&msg=RemoveSuccess&lang="&S_LANG)
End If
%>